<template>
    <el-dialog title="新增" :visible="isShowAddDialog" @close="dialogClose">
        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px">
            <el-form-item label="机构名称" prop="name">
                <el-input v-model="ruleForm.name"></el-input>
            </el-form-item>
            <el-form-item label="简介" prop="introduction">
                <!-- <QuillEditor class="editor" v-model="ruleForm.introduce"></QuillEditor> -->
                <el-input type="textarea" v-model="ruleForm.introduction" :rows="2"></el-input>
            </el-form-item>
            <el-form-item label="类型" prop="type">
                <el-select v-model="ruleForm.type" clearable>
                    <el-option value="1" label="1"></el-option>
                    <el-option value="2" label="2"></el-option>
                </el-select>
            </el-form-item>
            <!-- <el-form-item label="省份" prop="province">
                <el-input v-model="ruleForm.province"></el-input>
            </el-form-item>
            <el-form-item label="所在城市" prop="city">
                <el-input v-model="ruleForm.city"></el-input>
            </el-form-item> -->
            <el-form-item label="地址" prop="address">
                <el-input v-model="ruleForm.address"></el-input>
            </el-form-item>
            <el-form-item label="联系电话" prop="phone">
                <el-input v-model="ruleForm.phone"></el-input>
            </el-form-item>
            <el-form-item label="备注" prop="remark">
                <el-input type="textarea" v-model="ruleForm.remark" :rows="2"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" class="pull-right margin-l-25" @click="submitData">确定</el-button>
                <el-button class="pull-right" @click="dialogClose">取消</el-button>
            </el-form-item>
        </el-form>
    </el-dialog>

</template>
  
<script>
// import QuillEditor from '../../../components/pages/quillEditor.vue'
import { addCooperation } from '@/api/systemAdministrator/cooperationManage';
export default {
    components: {
        // QuillEditor
    },
    data () {
        return {
            ruleForm: {},
            rules: {
                name: [
                    { required: true, message: '请输入', trigger: 'blur' }
                ],
                introduction: [
                    { required: true, message: '请输入', trigger: 'blur' }
                ],
                // province: [
                //     { required: true, message: '请输入', trigger: 'blur' }
                // ],
                // city: [
                //     { required: true, message: '请输入', trigger: 'blur' }
                // ],
                address: [
                    { required: true, message: '请输入', trigger: 'blur' }
                ],
                phone: [
                    { required: true, message: '请输入', trigger: 'blur' }
                ],
                type: [
                    { required: true, message: '请选择', trigger: 'change' }
                ],
            }
        }
    },
    props: {
        isShowAddDialog: {
            type: Boolean
        },
    },
    methods: {
        dialogClose () {
            this.$emit('dialogClose');
        },
        submitData () {
            this.$refs.ruleForm.validate((valid) => {
                if (valid) {
                    addCooperation(this.ruleForm).then((res) => {
                        if (res) {
                            this.$message.success('操作成功')
                            this.$emit('dialogClose')
                            this.$emit('getList')
                        }
                    })
                }
                else {
                    return
                }
            });
        },

    }
}
</script>
  
<style scoped lang="less">
.editor {
    height: 200px;
    margin-bottom: 100px;
}

.select {
    width: 100%;
}

.el-radio__label {
    padding-left: 6px !important;
}

.el-row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.select {
    width: 100%;
}

.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.avatar-uploader .el-upload:hover {
    border-color: #409EFF;
}

.avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
}

.avatar {
    width: 178px;
    height: 178px;
    display: block;
}

.el-dialog__close,
.el-message-box__close {
    color: #606266 !important;
}
</style>
  
  